package com.bw.mapper;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface VoMapper {

    @Select("select sum(amount) `val` from order_info where date (create_time)='2023-01-06'")
    double getlist1();
    @Select("select bo.org_name `name`,\n" +
            "       sum(tt.actual_distance) `distance`,\n" +
            "       count(tt.id) `num`,\n" +
            "       sum(timestampdiff(second ,actual_start_time,actual_end_time)) `time`,\n" +
            "       sum(timestampdiff(second ,actual_start_time,actual_end_time))/count(tt.id) `avgTime`,\n" +
            "       sum(tt.actual_distance)/count(tt.id) `avgDistance`,\n" +
            "       rank() over (order by count(tt.id) desc) `pm`\n" +
            "from transport_task tt\n" +
            "left join line_base_info lbi on lbi.id = tt.line_id\n" +
            "left join base_organ bo on bo.id = lbi.org_id\n" +
            "group by bo.org_name")
    List<Vo1> getlist2();
    @Select("select if(bd.name='运输中','发单总数','完成运单数') `name`,count(*) `value` from transport_task tt\n" +
            "left join base_dic bd on bd.id = tt.status\n" +
            "group by bd.name\n" +
            "union\n" +
            "select '接单总数' `name`,count(*) `value` from transport_task")
    List<Vo> getlist3();
}
